<?php

use \Workerman\Autoloader;

require_once __DIR__ . '/../../../../Workerman/Autoloader.php';
require_once __DIR__.'/../../Config/Const.php';
Autoloader::setRootPath(__DIR__.'/../..');
$date = date("Y-m-d-H:i:s");

$exec="mysqldump -u root -pfan1989115 tree_main> ".__DIR__."/tree_main_".$date.".sql";
exec($exec);

$productor_list = \Data\Tree_productor_DAO::getList();
foreach ($productor_list as $productor_record) {
    \Data\Tree_productor_hist_DAO::insertEveryMonth($productor_record);
}

\Data\Tree_productor_DAO::updateEveryMonth();
echo "ok";
